package cn.com.aisat.android.videoshow.adapter;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import cn.com.aisat.android.videoshow.R;
import cn.com.aisat.android.videoshow.data.MovieItem;

import android.content.Context;
import android.net.Uri;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

public class GridViewAdapter extends BaseAdapter{
	private LayoutInflater mInflater;
	List<MovieItem>  items = null;
	private Context context;

	public GridViewAdapter(Context context, List<MovieItem>  items) {
		mInflater = LayoutInflater.from(context);
		this.items = items;
		this.context = context;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.gridview_item,
					null);
			holder = new ViewHolder();
			holder.image = (ImageView) convertView.findViewById(R.id.gridview_item_imageview);
			holder.text = (TextView) convertView.findViewById(R.id.gridview_item_text);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.image.setImageResource(R.drawable.move_no_pic);
		holder.text.setText(items.get(position).getName());
		return convertView;
	}

	public  int getCount() {
		return items.size();
	}

	public  Object getItem(int position) {
		return items.get(position);
	}

	public  long getItemId(int position) {
		return position;
	}
}

 class ViewHolder {
	TextView text;
	ImageView   image;
}
